﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using Newtonsoft.Json;
using SqlSugar;

namespace Aioms.Models
{
    ///<summary>
    ///
    ///</summary>
    [ExcelExporter(Name = "设备")]
    [SugarTable("device")]
    public class Device
    {
        public Device()
        {
            this.Created = DateTime.Now;
            this.Updated = DateTime.Now;
        }
        /// <summary>
        /// Desc:
        /// Default:
        /// Nullable:False
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")]
        public long Id { get; set; }

        /// <summary>
        /// Desc:企业ID
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "eid")]
        public long Eid { get; set; }

        /// <summary>
        /// Desc:区域ID
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "aeid")]
        public long Aeid { get; set; }

        /// <summary>
        /// Desc:设备类型ID
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "dvtid")]
        public long Dvtid { get; set; }

        /// <summary>
        /// Desc:设备名称
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "设备名称")]
        [SugarColumn(ColumnName = "name")]
        public string Name { get; set; }

        /// <summary>
        /// Desc:设备编号
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "设备编号")]
        [SugarColumn(ColumnName = "number")]
        public string Number { get; set; }

        /// <summary>
        /// Desc:规格型号
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "规格型号")]
        [SugarColumn(ColumnName = "specification")]
        public string Specification { get; set; }

        /// <summary>
        /// Desc:设备类型
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "设备类型")]
        [SugarColumn(ColumnName = "dvtname")]
        public string Dvtname { get; set; }

        /// <summary>
        /// Desc:所属区域名称
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "所属区域名称")]
        [SugarColumn(ColumnName = "aename")]
        public string Aename { get; set; }

        /// <summary>
        /// Desc:设备位置
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "设备位置")]
        [SugarColumn(ColumnName = "position")]
        public string Position { get; set; }

        /// <summary>
        /// 详细位置文字描述信息
        /// </summary>           
        [ExporterHeader(DisplayName = "位置信息")]
        [SugarColumn(ColumnName = "fulladdress")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string FullAddress { get; set; } = "";

        /// <summary>
        /// Desc:购置日期
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "购置日期", Format = "yyyy-mm-DD hh:mm:ss")]
        [SugarColumn(ColumnName = "purchase_date")]
        public DateTime PurchaseDate { get; set; }

        /// <summary>
        /// Desc:生产厂商
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "生产厂商")]
        [SugarColumn(ColumnName = "manufacturer")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string Manufacturer { get; set; } = "";

        /// <summary>
        /// Desc:供应商
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "供应商")]
        [SugarColumn(ColumnName = "provider")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string Provider { get; set; } = "";

        /// <summary>
        /// Desc:设备模型
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "设备模型")]
        [SugarColumn(ColumnName = "model")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string Model { get; set; } = "";

        /// <summary>
        /// Desc:设备描述
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "设备描述")]
        [SugarColumn(ColumnName = "description")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string Description { get; set; } = "";

        /// <summary>
        /// Desc:设备封面
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "cover")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string Cover { get; set; } = "";

        /// <summary>
        /// Desc:设备状态
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "设备状态")]
        [SugarColumn(ColumnName = "status")]
        public string Status { get; set; }

        /// <summary>
        /// 软删除标记：1.删除 0.未删除
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "isdel")]
        public int IsDel { get; set; } = 0;

        /// <summary>
        /// Desc:
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "created")]
        public DateTime? Created { get; set; }

        /// <summary>
        /// Desc:
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "updated")]
        public DateTime? Updated { get; set; }

        /// <summary>
        /// Desc:
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(IsIgnore = true)]
        [JsonProperty("devicetype")]
        public DeviceType DeviceType { get; set; }

        /// <summary>
        /// Desc:
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(IsIgnore = true)]
        [JsonProperty("area")]
        public Area Area { get; set; }

    }
}
